// 自定义hook

import { useState } from "react"


function App() {
  const [ val, setVal ] = useState(true)
  const toggle = () => setVal(!val)
  return (
    <div>
      {val && <div>this is div</div>}
      <button onClick={toggle}>toggle</button>
    </div>
  )
}   

export default App
